/*云闪推——空间管理*/

import request from '@/utils/request';
import {object2Url} from "@/utils/trans";


// 新增空间/修改空间 传id区分
export async function addSpace (data) {
  const res = await request.post('/business/space/add', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 删除空间配置 ids
export async function delSpace (data) {
  const res = await request.post('/business/space/delete', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 根据id查询空间_编辑空间回显
export async function getSpaceInfo (data) {
  const res = await request.post('/business/space/getPageId', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}


// 分页查询空间列表
export async function querySpace (data) {
  const res = await request.post('/business/space/pageList', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
